home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / xm-hp300hpux.h < prev    next >
C/C++ Source or Header  |  1992-09-11  |  6KB  |  174 lines

  1. /* Parameters for execution on an HP 9000 model 320, for GDB, the GNU debugger.
  2.    Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #define HOST_BYTE_ORDER BIG_ENDIAN
  21.  
  22. /* Define this to indicate problems with traps after continuing.  */
  23. #define HP_OS_BUG
  24.  
  25. /* fetch_inferior_registers is in hp300hpux-dep.c.  */
  26. #define FETCH_INFERIOR_REGISTERS
  27.  
  28. /* Set flag to indicate whether HP's assembler is in use. */
  29. #ifdef __GNUC__
  30. #ifdef __HPUX_ASM__
  31. #define HPUX_ASM
  32. #endif
  33. #else /* not GNU C.  */
  34. #define HPUX_ASM
  35. #endif /* not GNU C.  */
  36.  
  37. /* Define this for versions of hp-ux older than 6.0 */
  38. /* #define HPUX_VERSION_5 */
  39.  
  40. /* define USG if you are using sys5 /usr/include's */
  41. #undef USG    /* In case it was defined in the Makefile for cplus-dem.c */
  42. #define USG
  43.  
  44. #define HAVE_TERMIO
  45.  
  46. /* Get rid of any system-imposed stack limit if possible.  */
  47. /* The hp9k320.h doesn't seem to have this feature.  */
  48. /* #define SET_STACK_LIMIT_HUGE */
  49. /* So we'll just have to avoid big alloca's.  */
  50. #define BROKEN_LARGE_ALLOCA
  51.  
  52. /* This is the amount to subtract from u.u_ar0
  53.    to get the offset in the core file of the register values.  */
  54.  
  55. #ifdef HPUX_VERSION_5
  56. #define KERNEL_U_ADDR 0x00979000
  57. #else /* Not HPUX version 5.  */
  58. /* Use HPUX-style nlist() to get kernel_u_addr.  */
  59. #define KERNEL_U_ADDR_HPUX
  60. #endif /* Not HPUX version 5.  */
  61.  
  62. #define REGISTER_ADDR(u_ar0, regno)                    \
  63.   (unsigned int)                            \
  64.   (((regno) < PS_REGNUM)                        \
  65.    ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)])    \
  66.    : (((regno) == PS_REGNUM)                        \
  67.       ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS))        \
  68.       : (&((struct exception_stack *) (u_ar0))->e_PC)))
  69.  
  70. #define FP_REGISTER_ADDR(u, regno)                    \
  71.   (((char *)                                \
  72.     (((regno) < FPC_REGNUM)                        \
  73.      ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
  74.      : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)])))    \
  75.    - ((char *) (& u)))
  76.  
  77. /* Do implement the attach and detach commands.  */
  78.  
  79. #define ATTACH_DETACH
  80.  
  81. /* Interface definitions for kernel debugger KDB.  */
  82.  
  83. /* Map machine fault codes into signal numbers.
  84.    First subtract 0, divide by 4, then index in a table.
  85.    Faults for which the entry in this table is 0
  86.    are not handled by KDB; the program's own trap handler
  87.    gets to handle then.  */
  88.  
  89. #define FAULT_CODE_ORIGIN 0
  90. #define FAULT_CODE_UNITS 4
  91. #define FAULT_TABLE    \
  92. { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
  93.   0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
  94.   0, 0, 0, 0, 0, 0, 0, 0, \
  95.   SIGILL }
  96.  
  97. #ifndef HPUX_ASM
  98.  
  99. /* Start running with a stack stretching from BEG to END.
  100.    BEG and END should be symbols meaningful to the assembler.
  101.    This is used only for kdb.  */
  102.  
  103. #define INIT_STACK(beg, end)  \
  104. { asm (".globl end");         \
  105.   asm ("movel $ end, sp");      \
  106.   asm ("clrl fp"); }
  107.  
  108. /* Push the frame pointer register on the stack.  */
  109. #define PUSH_FRAME_PTR        \
  110.   asm ("movel fp, -(sp)");
  111.  
  112. /* Copy the top-of-stack to the frame pointer register.  */
  113. #define POP_FRAME_PTR  \
  114.   asm ("movl (sp), fp");
  115.  
  116. /* After KDB is entered by a fault, push all registers
  117.    that GDB thinks about (all NUM_REGS of them),
  118.    so that they appear in order of ascending GDB register number.
  119.    The fault code will be on the stack beyond the last register.  */
  120.  
  121. #define PUSH_REGISTERS        \
  122. { asm ("clrw -(sp)");          \
  123.   asm ("pea 10(sp)");          \
  124.   asm ("movem $ 0xfffe,-(sp)"); }
  125.  
  126. /* Assuming the registers (including processor status) have been
  127.    pushed on the stack in order of ascending GDB register number,
  128.    restore them and return to the address in the saved PC register.  */
  129.  
  130. #define POP_REGISTERS          \
  131. { asm ("subil $8,28(sp)");     \
  132.   asm ("movem (sp),$ 0xffff"); \
  133.   asm ("rte"); }
  134.  
  135. #else /* HPUX_ASM */
  136.  
  137. /* Start running with a stack stretching from BEG to END.
  138.    BEG and END should be symbols meaningful to the assembler.
  139.    This is used only for kdb.  */
  140.  
  141. #define INIT_STACK(beg, end)                        \
  142. { asm ("global end");                            \
  143.   asm ("mov.l &end,%sp");                        \
  144.   asm ("clr.l %a6"); }
  145.  
  146. /* Push the frame pointer register on the stack.  */
  147. #define PUSH_FRAME_PTR                            \
  148.   asm ("mov.l %fp,-(%sp)");
  149.  
  150. /* Copy the top-of-stack to the frame pointer register.  */
  151. #define POP_FRAME_PTR                            \
  152.   asm ("mov.l (%sp),%fp");
  153.  
  154. /* After KDB is entered by a fault, push all registers
  155.    that GDB thinks about (all NUM_REGS of them),
  156.    so that they appear in order of ascending GDB register number.
  157.    The fault code will be on the stack beyond the last register.  */
  158.  
  159. #define PUSH_REGISTERS                            \
  160. { asm ("clr.w -(%sp)");                            \
  161.   asm ("pea 10(%sp)");                            \
  162.   asm ("movm.l &0xfffe,-(%sp)"); }
  163.  
  164. /* Assuming the registers (including processor status) have been
  165.    pushed on the stack in order of ascending GDB register number,
  166.    restore them and return to the address in the saved PC register.  */
  167.  
  168. #define POP_REGISTERS                            \
  169. { asm ("subi.l &8,28(%sp)");                        \
  170.   asm ("mov.m (%sp),&0xffff");                        \
  171.   asm ("rte"); }
  172.  
  173. #endif /* HPUX_ASM */
  174.